﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace AppFlat.Application.IService
{
    public interface IBaseService<T>
    {
        Task<bool> AddAsync(T model);
        Task<bool> UpdateAsync(T model);
        Task<bool> DeleteAsync(T model);

        IQueryable<T> GetEntities(Expression<Func<T, bool>> lambdaWhere = null);
        

        Task<T> GetEntityAsync(Expression<Func<T, bool>> whereLambda);

        IQueryable<T> GetEntities<OrderField>(int pageIndex, int pageSize, out int total,
            Expression<Func<T, bool>> whereLambda, Expression<Func<T, OrderField>> orderBy, bool isAsc);
    }
}
